package org.example.service.impl;

import org.example.dao.UserDao;
import org.example.dao.impl.UserDaoImpl;
import org.example.entity.User;
import org.example.service.UserService;

/**
 * 用户的业务逻辑层类
 */
public class UserServiceImpl implements UserService {
    UserDao userDao = new UserDaoImpl();

    // 业务层当中的方法名跟业务逻辑有关，比如这个方法的名字叫做login（登录）
    public boolean login(String userName,String password) {
        User user = userDao.getUserByUserName(userName);
        if(user != null) {
            if (user.getPassword().equals(password)) {
                return true;
            }
        }
        return false;
    }
}
